package com.ruoyi.rpt.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.PreAuthorize;
import com.ruoyi.rpt.domain.RptOrderProgress;
import com.ruoyi.rpt.service.IRptOrderProgressService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;

/**
 * 订单进展情况Controller
 * 
 * @author ruoyi
 * @date 2021-11-10
 */
@RestController
@RequestMapping("/orderProgress")
public class RptOrderProgressController extends BaseController
{
    @Autowired
    private IRptOrderProgressService rptOrderProgressService;

    /**
     * 查询订单进展情况列表
     */
    @PreAuthorize(hasPermi = "rpt:orderProgress:list")
    @GetMapping("/list")
    public TableDataInfo list(RptOrderProgress rptOrderProgress)
    {
        startPage();
        List<RptOrderProgress> list = rptOrderProgressService.selectRptOrderProgressList(rptOrderProgress);
        return getDataTable(list);
    }

    /**
     * 导出订单进展情况列表
     */
    @PreAuthorize(hasPermi = "rpt:orderProgress:export")
    @Log(title = "订单进展情况", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, RptOrderProgress rptOrderProgress) throws IOException
    {
        List<RptOrderProgress> list = rptOrderProgressService.selectRptOrderProgressList(rptOrderProgress);
        ExcelUtil<RptOrderProgress> util = new ExcelUtil<RptOrderProgress>(RptOrderProgress.class);
        util.exportExcel(response, list, "订单进展情况数据");
    }

    /**
     * 获取订单进展情况详细信息
     */
    @PreAuthorize(hasPermi = "rpt:orderProgress:query")
    @GetMapping(value = "/{orderProgressUuid}")
    public AjaxResult getInfo(@PathVariable("orderProgressUuid") String orderProgressUuid)
    {
        return AjaxResult.success(rptOrderProgressService.selectRptOrderProgressByOrderProgressUuid(orderProgressUuid));
    }

    /**
     * 新增订单进展情况
     */
    @PreAuthorize(hasPermi = "rpt:orderProgress:add")
    @Log(title = "订单进展情况", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody RptOrderProgress rptOrderProgress)
    {
        return toAjax(rptOrderProgressService.insertRptOrderProgress(rptOrderProgress));
    }

    /**
     * 修改订单进展情况
     */
    @PreAuthorize(hasPermi = "rpt:orderProgress:edit")
    @Log(title = "订单进展情况", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody RptOrderProgress rptOrderProgress)
    {
        return toAjax(rptOrderProgressService.updateRptOrderProgress(rptOrderProgress));
    }

    /**
     * 删除订单进展情况
     */
    @PreAuthorize(hasPermi = "rpt:orderProgress:remove")
    @Log(title = "订单进展情况", businessType = BusinessType.DELETE)
	@DeleteMapping("/{orderProgressUuids}")
    public AjaxResult remove(@PathVariable String[] orderProgressUuids)
    {
        return toAjax(rptOrderProgressService.deleteRptOrderProgressByOrderProgressUuids(orderProgressUuids));
    }
}
